clear all

capture prog drop nice
prog define nice
quietly{
return clear
global outcome=e(depvar)
matrix define B=e(b)
matrix define B=B'
local no_words=rowsof(B)

local names: rownames B

forval i=1/`no_words' {
local word`i': word `i' of `names'
local check`i'=substr("`word`i''",1,2)
local check2`i'=substr("`word`i''",1,5)
local del_word`i'=substr("`word`i''",1,.)
if "`check`i''"=="o." {
local word`i'=subinstr("`word`i''","`del_word`i''","",.)
}
if "`check2`i''"=="_cons" {
local word`i'=subinstr("`word`i''","`del_word`i''","",.)
}
}

local names2= "`word1'" 
forval i=2/`no_words' {
if "`word`i''"!="" {
local names2  `names2' `word`i''
}
}
global names2 `names2'
}
end
#delimit;

capture log close;
set mem 600000;
set mat 1000;
set more off;


log using "C:\Old C Drive\F\INTIKAM2009\RESTAT\WEB_Final\Table6.log",replace;



 
use "C:\Old C Drive\F\INTIKAM2009\RESTAT\WEB_Final\Table7_8data1.dta";



/* TABLE 6 REGRESSIONS with NEW country variables */

tab region, gen(reg); 
bysort region country year: egen howmany=count(intikam222);

#delimit ;
oprobit intikam222 burgtly burgbef protection gun_coll male up50 edu avrburgtly_region  citysmall citymiddle
 _20to24age _25to29age _30to34age _35to39age _40to44age _45to49age _50to54age _55to59age _60to64age _65to69age _70plusage 
 single widow livtogether divorced  working lookforjob homekeeper ret_disab 
 individualism rule_of_law_mean elf85 english french german catholic muslim  
 democratic rgdpch1 kg pop1  _0to25per_new sch25Mean womenMean war752000_noint     
 year1-year10 dedu reg1-reg339 europe c_europe mediter newasia2 africa lat_amer [pweight=w005]
,robust cluster(count_code);
 nice;
 oprobit $outcome $names2 [pweight=w005],robust cluster(count_code) ;
meoprobit;
meoprobit, stats(p);

#delimit ;
dprobit   two_plus burgtly burgbef protection gun_coll male up50 edu avrburgtly_region  citysmall citymiddle
 _20to24age _25to29age _30to34age _35to39age _40to44age _45to49age _50to54age _55to59age _60to64age _65to69age _70plusage 
 single widow livtogether divorced  working lookforjob homekeeper ret_disab 
 individualism rule_of_law_mean elf85 english french german catholic muslim  
 democratic rgdpch1 kg pop1  _0to25per_new sch25Mean womenMean war752000_noint     
 year1-year10 dedu reg1-reg339 europe c_europe mediter newasia2 africa lat_amer [pweight=w005] 
 ,robust cluster(count_code);


/* no city */

#delimit ;
oprobit intikam222 burgtly burgbef protection gun_coll male up50 edu avrburgtly_region 
 _20to24age _25to29age _30to34age _35to39age _40to44age _45to49age _50to54age _55to59age _60to64age _65to69age _70plusage 
 single widow livtogether divorced  working lookforjob homekeeper ret_disab 
 individualism rule_of_law_mean elf85 english french german catholic muslim  
 democratic rgdpch1 kg pop1  _0to25per_new sch25Mean womenMean war752000_noint     
 year1-year10 dedu reg1-reg339 europe c_europe mediter newasia2 africa lat_amer [pweight=w005] 
,robust cluster(count_code);
 nice;
 oprobit $outcome $names2 [pweight=w005],robust cluster(count_code) ;
meoprobit;
meoprobit, stats(p);

#delimit ;
dprobit two_plus  burgtly burgbef protection gun_coll male up50 edu avrburgtly_region  
 _20to24age _25to29age _30to34age _35to39age _40to44age _45to49age _50to54age _55to59age _60to64age _65to69age _70plusage 
 single widow livtogether divorced  working lookforjob homekeeper ret_disab 
 individualism rule_of_law_mean elf85 english french german catholic muslim  
 democratic rgdpch1 kg pop1  _0to25per_new sch25Mean womenMean war752000_noint     
 year1-year10 dedu reg1-reg339 europe c_europe mediter newasia2 africa lat_amer [pweight=w005]  
,robust cluster(count_code);


/* No country chars */

#delimit ;
oprobit intikam222 burgtly burgbef protection gun_coll male up50 edu avrburgtly_region  citysmall citymiddle
 _20to24age _25to29age _30to34age _35to39age _40to44age _45to49age _50to54age _55to59age _60to64age _65to69age _70plusage 
 single widow livtogether divorced  working lookforjob homekeeper ret_disab 
 year1-year10 dedu reg1-reg339 europe c_europe mediter newasia2 africa lat_amer [pweight=w005] ,
robust cluster(count_code);
 nice;
 
oprobit $outcome $names2 [pweight=w005],robust cluster(count_code) ;
meoprobit;
meoprobit, stats(p);

#delimit ;
dprobit  two_plus  burgtly burgbef protection gun_coll male up50 edu avrburgtly_region  citysmall citymiddle
 _20to24age _25to29age _30to34age _35to39age _40to44age _45to49age _50to54age _55to59age _60to64age _65to69age _70plusage 
 single widow livtogether divorced  working lookforjob homekeeper ret_disab 
year1-year10 dedu reg1-reg339 europe c_europe mediter newasia2 africa lat_amer [pweight=w005] 
,robust cluster(count_code);


 
oprobit $outcome $names2 [pweight=w005],robust cluster(count_code) ;
meoprobit;
meoprobit, stats(p);


log close;
